<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 13哥 <yzb321055156@163.com>
// +----------------------------------------------------------------------
namespace app\api\model;
use think\Model;
class ImsXbFindModel extends Model
{
    /**
     * 获取观看视频人数
     */
    public function getlookcount()
    {
        return $this->hasMany('ImsVideoLookRecordeModel', 'video_id', 'id')->field('video_id');
    }

    //标签（0-无，1-推荐，2-职业素养，3-销售达人炼成秘籍，4-销售达人练成秘籍）

    /**
     * 获取评分
     */
    public function getvideoscore()
    {
        return $this->hasMany('ImsVideoScoreModel', 'video_id', 'id')->field('AVG(score) as avg');
    }

    /**
     * 获取发表视频的用户信息
     */
    public function getuserinfo()
    {
        return $this->hasOne('ImsMemberModel', 'id', 'user_id')->field('staff_name,staff_pic,id,staff_deptname');
    }

    /**
     * 获取评论信息
     */

    public function getcommentinfo()
    {
        return $this->hasMany('CommentModel', 'object_id', 'id')->field('object_id,user_id,content,create_time')->where(['delete_time' => ['neq',0]]);
    }



}